import win32clipboard as w
import win32con
import base64
from urllib import request, parse

def getText():
    w.OpenClipboard()
    d = w.GetClipboardData(win32con.CF_UNICODETEXT)
    w.EmptyClipboard()
    w.CloseClipboard()
    return d

a = getText()
a = a.encode("utf-8")
data = base64.b64encode(a)

url = r"http://192.168.0.102/ksjh/api/web/plain/receive-data"
lottery = {'data': data,'code':'cfad953660aade768b72064c88e6e9a8'}
post_data = parse.urlencode(lottery).encode('utf-8')
request_ok = request.Request(url,post_data)
response_read = request.urlopen(request_ok).read().decode('utf-8')
# print(response_read)